package MainPage;

import java.awt.Cursor;
import java.sql.SQLException;

import javax.swing.JOptionPane;

public class userDetails extends javax.swing.JFrame {

	String gender;
    /** Creates new form USER_DETAILS */
    public userDetails() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        USER_DETAILSLayeredPane = new javax.swing.JLayeredPane();
        jbtnhome = new javax.swing.JButton();
        jlabelheader = new javax.swing.JLabel();
        detailsTabbedPane = new javax.swing.JTabbedPane();
        detailsTabbedPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        outertabpersonalPanel = new javax.swing.JPanel();
        personalPanel = new javax.swing.JPanel();
        fnameLabel = new javax.swing.JLabel();
        addressLabel = new javax.swing.JLabel();
        addressScrollPane = new javax.swing.JScrollPane();
        addressTextArea = new javax.swing.JTextArea();
        fnameTextField = new javax.swing.JTextField();
        ageTextField = new javax.swing.JTextField();
        ageLabel = new javax.swing.JLabel();
        DOBLabel = new javax.swing.JLabel();
        DOBTextField = new javax.swing.JTextField();
        genderLabel = new javax.swing.JLabel();
        genderTextField = new javax.swing.JTextField();
        lnameLabel = new javax.swing.JLabel();
        lnameTextField = new javax.swing.JTextField();
        cityLabel = new javax.swing.JLabel();
        cityTextField = new javax.swing.JTextField();
        picLabel = new javax.swing.JLabel();
        countryLabel = new javax.swing.JLabel();
        countryTextField = new javax.swing.JTextField();
        editPButton = new javax.swing.JButton();
        updatePButton = new javax.swing.JButton();
        importantdatesPanel = new javax.swing.JPanel();
        birthdayLabel = new javax.swing.JLabel();
        birthdayTextField1 = new javax.swing.JTextField();
        birthdayTextField2 = new javax.swing.JTextField();
        birthdayTextField3 = new javax.swing.JTextField();
        anniversariesLabel = new javax.swing.JLabel();
        anniversariesTextField1 = new javax.swing.JTextField();
        anniversariesTextField2 = new javax.swing.JTextField();
        socialeventsTextField1 = new javax.swing.JTextField();
        socialeventsLabel = new javax.swing.JLabel();
        socialeventsTextField2 = new javax.swing.JTextField();
        socialeventsTextField3 = new javax.swing.JTextField();
        editIButton = new javax.swing.JButton();
        updateIButton = new javax.swing.JButton();
        accountPanel = new javax.swing.JPanel();
        nameaccountLabel = new javax.swing.JLabel();
        usernameLabel = new javax.swing.JLabel();
        changenameButton = new javax.swing.JButton();
        usernameTextField = new javax.swing.JTextField();
        passwordaccountLabel = new javax.swing.JLabel();
        passwordLabel = new javax.swing.JLabel();
        passwordButton = new javax.swing.JButton();
        jPasswordField1 = new javax.swing.JPasswordField();
        jlabelborder = new javax.swing.JLabel();
        backgroundLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("MyOrganizer");
        setAlwaysOnTop(true);

        jbtnhome.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/home-button.jpg"))); // NOI18N
        jbtnhome.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jbtnhome.setBounds(20, 20, 50, 50);
        
        jbtnhome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	firstPage.playAudio2(getClass().getResource("/resource/buttonHit.wav").getFile());
                homeButtonActionPerformed(evt);
            }
        });
        USER_DETAILSLayeredPane.add(jbtnhome, javax.swing.JLayeredPane.DEFAULT_LAYER);

        
        
        jlabelheader.setFont(new java.awt.Font("Algerian", 1, 36));
        jlabelheader.setForeground(new java.awt.Color(102, 0, 0));
        jlabelheader.setText("PROFILES");
        jlabelheader.setBounds(550, 40, 197, 70);
        USER_DETAILSLayeredPane.add(jlabelheader, javax.swing.JLayeredPane.DEFAULT_LAYER);

          fnameLabel.setText("First Name              :");
        addressLabel.setText("Address                  :");
            ageLabel.setText("Age                          :");
            DOBLabel.setText("D.O.B                       :");
         genderLabel.setText("Gender                    :");
          lnameLabel.setText("Last Name              :");
           cityLabel.setText("City                          :");
        countryLabel.setText("Country                   :");
        addressTextArea.setColumns(20);
        addressTextArea.setRows(5);
        addressTextArea.setFocusable(false);
        addressScrollPane.setViewportView(addressTextArea);

        fnameTextField.setFocusable(false);
        ageTextField.setFocusable(false);
        DOBTextField.setFocusable(false);
        genderTextField.setFocusable(false);
        genderTextField.setToolTipText("male/female");
        lnameTextField.setFocusable(false);
        cityTextField.setFocusable(false);

        picLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/user_female.png"))); // NOI18N

        countryTextField.setFocusable(false);

        editPButton.setText("EDIT");
        editPButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        editPButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	firstPage.playAudio2(getClass().getResource("/resource/buttonHit.wav").getFile());
                editPButtonActionPerformed(evt);
            }
        });

        updatePButton.setText("UPDATE");
        updatePButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        updatePButton.setEnabled(false);
        updatePButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	firstPage.playAudio2(getClass().getResource("/resource/buttonHit.wav").getFile());
                updatePButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout personalPanelLayout = new javax.swing.GroupLayout(personalPanel);
        personalPanel.setLayout(personalPanelLayout);
        personalPanel.setCursor(Cursor.getDefaultCursor());
        personalPanelLayout.setHorizontalGroup(
            personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(personalPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(personalPanelLayout.createSequentialGroup()
                            .addComponent(fnameLabel)
                            .addGap(30, 30, 30)
                            .addComponent(fnameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(personalPanelLayout.createSequentialGroup()
                            .addComponent(lnameLabel)
                            .addGap(30, 30, 30)
                            .addComponent(lnameTextField)))
                    .addComponent(genderLabel)
                    .addGroup(personalPanelLayout.createSequentialGroup()
                        .addComponent(addressLabel)
                        .addContainerGap(421, Short.MAX_VALUE))
                    .addGroup(personalPanelLayout.createSequentialGroup()
                        .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ageLabel)
                            .addComponent(DOBLabel)
                            .addComponent(cityLabel)
                            .addComponent(countryLabel))
                        .addGap(30, 30, 30)
                        .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(personalPanelLayout.createSequentialGroup()
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(genderTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(ageTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 56, Short.MAX_VALUE)
                                .addComponent(picLabel))
                            .addGroup(personalPanelLayout.createSequentialGroup()
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(countryTextField, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cityTextField, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(addressScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
                                    .addComponent(DOBTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(editPButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(updatePButton, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE))))
                        .addContainerGap())))
        );
        personalPanelLayout.setVerticalGroup(
            personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(personalPanelLayout.createSequentialGroup()
                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(personalPanelLayout.createSequentialGroup()
                        .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(personalPanelLayout.createSequentialGroup()
                                .addGap(43, 43, 43)
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lnameLabel)
                                    .addComponent(lnameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(genderLabel)
                                    .addComponent(genderTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(ageLabel)
                                    .addComponent(ageTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(DOBLabel)
                                    .addComponent(DOBTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(personalPanelLayout.createSequentialGroup()
                                        .addGap(27, 27, 27)
                                        .addComponent(addressLabel))
                                    .addGroup(personalPanelLayout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addComponent(addressScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(fnameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(fnameLabel)))
                        .addGap(20, 20, 20)
                        .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cityLabel)
                            .addComponent(cityTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(personalPanelLayout.createSequentialGroup()
                        .addComponent(picLabel)
                        .addGap(207, 207, 207)
                        .addComponent(updatePButton)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                .addGroup(personalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(countryLabel)
                    .addComponent(countryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(editPButton))
                .addGap(22, 22, 22))
        );

        javax.swing.GroupLayout outertabpersonalPanelLayout = new javax.swing.GroupLayout(outertabpersonalPanel);
        outertabpersonalPanel.setLayout(outertabpersonalPanelLayout);
        outertabpersonalPanel.setCursor(Cursor.getDefaultCursor());
        outertabpersonalPanelLayout.setHorizontalGroup(
            outertabpersonalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(outertabpersonalPanelLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(personalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(20, Short.MAX_VALUE))
        );
        outertabpersonalPanelLayout.setVerticalGroup(
            outertabpersonalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(outertabpersonalPanelLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(personalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        detailsTabbedPane.addTab("PERSONAL", outertabpersonalPanel);

        nameaccountLabel.setText("User Name :");

        usernameLabel.setText("Your user name:");

        changenameButton.setText("Change");
        changenameButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	firstPage.playAudio2(getClass().getResource("/resource/buttonHit.wav").getFile());
                changenameButtonActionPerformed(evt);
            }
        });

        passwordaccountLabel.setText("Password  :");

        passwordLabel.setText("What you user to login");

        passwordButton.setText("Change");
        passwordButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	firstPage.playAudio2(getClass().getResource("/resource/buttonHit.wav").getFile());
                passwordButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout accountPanelLayout = new javax.swing.GroupLayout(accountPanel);
        accountPanel.setLayout(accountPanelLayout);
        accountPanel.setCursor(Cursor.getDefaultCursor());
        accountPanelLayout.setHorizontalGroup(
            accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(accountPanelLayout.createSequentialGroup()
                .addGap(94, 94, 94)
                .addGroup(accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(passwordLabel)
                    .addComponent(passwordaccountLabel)
                    .addComponent(usernameLabel)
                    .addComponent(nameaccountLabel))
                .addGap(137, 137, 137)
                .addGroup(accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(accountPanelLayout.createSequentialGroup()
                        .addGroup(accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(changenameButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(usernameTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)
                            .addComponent(passwordButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap(86, Short.MAX_VALUE))
                    .addGroup(accountPanelLayout.createSequentialGroup()
                        .addComponent(jPasswordField1, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                        .addGap(70, 70,70))))
        );
        accountPanelLayout.setVerticalGroup(
            accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(accountPanelLayout.createSequentialGroup()
                .addGap(64, 64, 64)
                .addGroup(accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nameaccountLabel)
                    .addComponent(changenameButton))
                .addGap(21, 21, 21)
                .addGroup(accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usernameLabel)
                    .addComponent(usernameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(54, 54, 54)
                .addGroup(accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(passwordaccountLabel)
                    .addComponent(passwordButton))
                .addGap(18, 18, 18)
                .addGroup(accountPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(passwordLabel))
                .addContainerGap(148, Short.MAX_VALUE))
        );

        detailsTabbedPane.addTab("ACCOUNT", accountPanel);

        detailsTabbedPane.setBounds(350, 170, 610, 450);
        USER_DETAILSLayeredPane.add(detailsTabbedPane, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jlabelborder.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jlabelborder.setBounds(300, 140, 700, 500);
        USER_DETAILSLayeredPane.add(jlabelborder, javax.swing.JLayeredPane.DEFAULT_LAYER);

        backgroundLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/user_detailsbackground.jpg"))); // NOI18N
        backgroundLabel.setBounds(0, -40, 1270, 820);
        USER_DETAILSLayeredPane.add(backgroundLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(USER_DETAILSLayeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1278, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(USER_DETAILSLayeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 760, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>         
    void performFirstPage()
	{
		//pane.removeAll();
		firstPage first_page=new firstPage()
		{
			public String getParameter(String name)
			{
		           if (name.equalsIgnoreCase("msg"))
		           {
		              return "Local Frame";
		           }
		           return null;
		    }
		};
		first_page.setSize(userMainPage.screensize.width,userMainPage.screensize.height);
		this.dispose();
		first_page.setVisible(true);
	}
    
    private void homeButtonActionPerformed(java.awt.event.ActionEvent evt) {
        performFirstPage();
     } 
    
    private void passwordButtonActionPerformed(java.awt.event.ActionEvent evt) {                                               
        new passwordChange().setVisible(true);
        setVisible(false);
}                                              

    private void changenameButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                 
        new userNameChange().setVisible(true);
        setVisible(false);
}                                                

    private void editPButtonActionPerformed(java.awt.event.ActionEvent evt) {                                            

       fnameTextField.setFocusable(true);
       lnameTextField.setFocusable(true);
       genderTextField.setFocusable(true);
       ageTextField.setFocusable(true);
       DOBTextField.setFocusable(true);
       addressTextArea.setFocusable(true);
       cityTextField.setFocusable(true);
       countryTextField.setFocusable(true);

        updatePButton.setEnabled(true);
        editPButton.setEnabled(false);
       
    }                                           
                                    

    private void updatePButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              
        String SQL;
        boolean correct=false;
        if (genderTextField.getText().toLowerCase().equals("male")||genderTextField.getText().toLowerCase().equals("m"))
        {
        	gender="M";
        	correct=true;
        }
        else if (genderTextField.getText().toLowerCase().equals("male")||genderTextField.getText().toLowerCase().equals("f"))
        {
        	gender="F";
        	correct=true;
        }
        else 
        {
        	JOptionPane.showMessageDialog(this,"Invalid gender input. Please try again!","Error Message",
	                JOptionPane.ERROR_MESSAGE);
        	genderTextField.setText("");
        	correct=false;
        }
        if(correct)
        {
        SQL="UPDATE USER_DETAIL SET USER_FNAME ='"+fnameTextField.getText()+"',USER_LNAME='"+lnameTextField.getText()+"',USER_GENDER='"+gender+"',USER_AGE="
             +ageTextField.getText().toString()+",USER_ADDRESS='"+addressTextArea.getText()+"',USER_CITY='"+cityTextField.getText()+
             "',USER_COUNTRY='"+countryTextField.getText()+"' WHERE USER_CODE="+userMainPage.userCode;
    	
    	try {
			userMainPage.stmt.executeQuery(SQL);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        JOptionPane.showMessageDialog(null, "Data have successfully been updated");
        updatePButton.setEnabled(false);
        editPButton.setEnabled(true);
        addressTextArea.setFocusable(false);
        fnameTextField.setFocusable(false);
        ageTextField.setFocusable(false);
        DOBTextField.setFocusable(false);
        genderTextField.setFocusable(false);
        lnameTextField.setFocusable(false);
        cityTextField.setFocusable(false);
        countryTextField.setFocusable(false);
        }
    }                                             
                                  

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new userDetails().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JLabel DOBLabel;
    public static javax.swing.JTextField DOBTextField;
    private javax.swing.JLayeredPane USER_DETAILSLayeredPane;
    private javax.swing.JPanel accountPanel;
    private javax.swing.JLabel addressLabel;
    private javax.swing.JScrollPane addressScrollPane;
    public static javax.swing.JTextArea addressTextArea;
    private javax.swing.JLabel ageLabel;
    public static javax.swing.JTextField ageTextField;
    private javax.swing.JLabel anniversariesLabel;
    public static javax.swing.JTextField anniversariesTextField1;
    public static javax.swing.JTextField anniversariesTextField2;
    private javax.swing.JLabel backgroundLabel;
    private javax.swing.JLabel birthdayLabel;
    public static javax.swing.JTextField birthdayTextField1;
    public static javax.swing.JTextField birthdayTextField2;
    public static javax.swing.JTextField birthdayTextField3;
    private javax.swing.JButton changenameButton;
    private javax.swing.JLabel cityLabel;
    public static javax.swing.JTextField cityTextField;
    private javax.swing.JLabel countryLabel;
    public static javax.swing.JTextField countryTextField;
    private javax.swing.JTabbedPane detailsTabbedPane;
    private javax.swing.JButton editIButton;
    private javax.swing.JButton editPButton;
    private javax.swing.JLabel fnameLabel;
    public static javax.swing.JTextField fnameTextField;
    private javax.swing.JLabel genderLabel;
    public static javax.swing.JTextField genderTextField;
    private javax.swing.JPanel importantdatesPanel;
    public static javax.swing.JPasswordField jPasswordField1;
    private javax.swing.JButton jbtnhome;
    private javax.swing.JLabel jlabelborder;
    private javax.swing.JLabel jlabelheader;
    private javax.swing.JLabel lnameLabel;
    public static javax.swing.JTextField lnameTextField;
    private javax.swing.JLabel nameaccountLabel;
    private javax.swing.JPanel outertabpersonalPanel;
    private javax.swing.JButton passwordButton;
    private javax.swing.JLabel passwordLabel;
    private javax.swing.JLabel passwordaccountLabel;
    private javax.swing.JPanel personalPanel;
    private javax.swing.JLabel picLabel;
    private javax.swing.JLabel socialeventsLabel;
    public static javax.swing.JTextField socialeventsTextField1;
    public static javax.swing.JTextField socialeventsTextField2;
    public static javax.swing.JTextField socialeventsTextField3;
    private javax.swing.JButton updateIButton;
    private javax.swing.JButton updatePButton;
    private javax.swing.JLabel usernameLabel;
    public static javax.swing.JTextField usernameTextField;
    // End of variables declaration                   

}
